<?php

namespace Mageplaza\HelloWorld\Controller\Adminhtml\Index;

class Index extends \Magento\Framework\App\Action\Action
{
    protected $_pageFactory;
    protected  $_postFactory;
    public function __construct(
        \Magento\Framework\App\Action\Context $context,
        \Magento\Framework\View\Result\PageFactory $pageFactory,
        \Mageplaza\HelloWorld\Model\PostFactory $postFactory

    )
    {
        $this->_pageFactory = $pageFactory;
        $this->_postFactory = $postFactory;
        return parent::__construct($context);
    }

    public function execute()
    {
      /*  $post = $this->_postFactory->create();
        $collection = $post->getCollection();
        foreach($collection as $item){
            var_dump($item->getData());
        }
        exit;*/
       /// 這個是測試對比看看對不對
        return $this->_pageFactory->create();
    }

    protected function _isAllowed()
    {

        return $this->_authorization->isAllowed('Mageplaza_HelloWorld::Index');
    }
}